package org.testfire.translator.watij;

import org.testfire.model.Engine;
import org.testfire.model.TestsetType;
import org.testfire.translator.TestFireTranslator;

/**
 * Created by IntelliJ IDEA.
 * User: granum
 * Date: Sep 2, 2007
 * Time: 3:52:34 PM
 *
 */
public class EngineToWatijTranslator<T> implements TestFireTranslator<Engine>
{

    /**
     * Will return a syntactically correct Java class, ready to be written out to a java file with the name
     * testset.getName() + ".java" and compiled.
     * @return The source code for a valid java class, containing all test cases.
     */
    public Object translate( TestsetType testset, Engine engine )
    {
        StringBuilder buf = new StringBuilder( );
        buf.append( "/** Engine: " ).append( engine.getValue() ).append( " */\n" );
        buf.append( String.format( "WatijBrowser engine_0 = new %1$s();\n\n", engine.getValue()));
        return buf.toString();
    }
}